﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        entUser entU = new entUser();
        entU.UserName = txt_username.Text;
        entU.Pass = txt_pass.Text;
        busUser busU = new busUser();
        List<entUser> lst = new List<entUser>();
        lst = busU.getUserDangNhap(entU);
        if (lst.Count > 0)
        {
            Session["userid"] = lst[0].Userid;
            Session["quyenid"] = lst[0].Quyenid;
            Session["username"] = lst[0].UserName;
            Session["khoa"] = lst[0].Khoa;
            Response.Redirect("/admin");
        }
        else
        {
            lb_tb.Text = "Lỗi đăng nhập";
        }
    }
}